﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Solution53
{
    public int MaxSubArray(int[] nums)
    {
        int sum = int.MinValue;

        for (int i = 0; i < nums.Length; i++)
        {


            sum = Math.Max(sum + nums[i], nums[i]);//说明前面的数是负作用，直接丢弃


        }

        Dictionary<int, int> map = new Dictionary<int, int>();
       
        return sum;



    }
}